package tau.dimes.config;

import java.io.InputStream;

import javax.servlet.ServletContext;

import tau.dimes.config.db.DatabaseConfiguration;
import tau.dimes.config.ipGeo.IpGeoConfiguration;
import tau.dimes.config.login.LoginConfiguration;

public class Configuration
{
	public static final String CONFIG_PATH = "/config/config.xml";
	
	public static void init(ServletContext context)
	{
		InputStream isConfig = context.getResourceAsStream(CONFIG_PATH);
		try
		{
			XmlConfigurationSource source = new XmlConfigurationSource(isConfig);
			
			DatabaseConfiguration.initInstance(source);
			LoginConfiguration.initInstance(source);
			IpGeoConfiguration.initInstance(source);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
